package com.huluobo.a2112mvvmdouyindemo.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.huluobo.a2112mvvmdouyindemo.R;
import com.huluobo.a2112mvvmdouyindemo.utils.ImageLoader;
import com.huluobo.mvvm_base.bean.GoodsBeanResult;

import java.util.List;

/**
 * Created by LC on 2024/4/9.
 */
public class ShopGoodsAdapter extends BaseQuickAdapter<GoodsBeanResult.GoodsBean, BaseViewHolder> {
    public ShopGoodsAdapter(@Nullable List<GoodsBeanResult.GoodsBean> data) {
        super(R.layout.item_shop_goods, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, GoodsBeanResult.GoodsBean goodsBean) {
        ImageLoader.getInstance().loadImage(getContext(), goodsBean.getGoods_default_icon(),
                baseViewHolder.getView(R.id.item_shop_goods_icon));
        baseViewHolder.setText(R.id.item_shop_goods_desc, goodsBean.getGoods_desc());
        baseViewHolder.setText(R.id.item_shop_goods_price, goodsBean.getGoods_default_price() + "元");
    }
}
